package com.zyp.controller;

import com.zyp.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tudedong
 * @description
 * @date 2020-07-05 16:35:57
 */
@RestController
@RequestMapping("/api/email")
@RefreshScope
public class EmailController {

    @Autowired
    private MailService emailService;



    /**
     * 发送验证码到邮箱,true成功，false失败
     * @param email
     * @param checkCode
     * @return
     */
    @GetMapping("/{email}/{code}")
    public Boolean sendMail(@PathVariable("email") String email,
                            @PathVariable("code") String checkCode) {
        return emailService.sendEmail(email, "注册验证码", checkCode);
    }

}
